{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Building prefix dict from the default dictionary ...\n",
      "Loading model from cache /tmp/jieba.cache\n",
      "Loading model cost 0.576 seconds.\n",
      "Prefix dict has been built successfully.\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "sys.path.append(\"..\")\n",
    "from MLSR.data import *\n",
    "#x = DataSet.do_nation_policy(data)\n",
    "#y = DataSet.do_income(data)\n",
    "x = DataSet('../data/rand_select_400_avg.csv')\n",
    "x.generate_feature()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'f0': '建档立卡贫困户',\n",
       " 'f1': '城乡低保户',\n",
       " 'f2': '五保户',\n",
       " 'f3': '孤残学生',\n",
       " 'f4': '军烈属或优抚子女',\n",
       " 'f5': '经商',\n",
       " 'f6': '务农',\n",
       " 'f7': '退休',\n",
       " 'f8': '低保',\n",
       " 'f9': '打工',\n",
       " 'f10': '父母均下岗',\n",
       " 'f11': '父母一方下岗',\n",
       " 'f12': '家庭人均年收入',\n",
       " 'f13': '大学',\n",
       " 'f14': '高中',\n",
       " 'f15': '义务教育',\n",
       " 'f16': '祖父母患病',\n",
       " 'f17': '父母离异',\n",
       " 'f18': '父亲（母亲）患普通疾病',\n",
       " 'f19': '父母患普通疾病',\n",
       " 'f20': '兄弟姐妹患重疾',\n",
       " 'f21': '父亲（母亲）患重疾',\n",
       " 'f22': '父母患重疾',\n",
       " 'f23': '父亲（母亲）去世',\n",
       " 'f24': '突发重大自然灾害',\n",
       " 'f25': '助学金个数',\n",
       " 'f26': '助学金金额',\n",
       " 'f27': '国助类型',\n",
       " 'f28': '民族',\n",
       " 'f29': '家庭人口',\n",
       " 'f30': '是否贷款',\n",
       " 'f31': '入学前户口性质'}"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x.features_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = DataSet('../data/not_selected_avg.csv')\n",
    "y.generate_feature()\n",
    "z = DataSet.static_merge(x, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "23    0.000120\n",
       "14    0.000120\n",
       "15    0.000120\n",
       "20    0.000120\n",
       "16    0.000240\n",
       "13    0.000240\n",
       "11    0.000360\n",
       "12    0.000480\n",
       "1     0.000601\n",
       "10    0.001802\n",
       "9     0.003003\n",
       "8     0.018616\n",
       "2     0.044319\n",
       "7     0.051165\n",
       "6     0.142806\n",
       "3     0.181119\n",
       "5     0.242734\n",
       "4     0.312035\n",
       "Name: f29, dtype: float64"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "z.features['f29'].astype('int64').value_counts(normalize=True, ascending=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "26400.0"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from scipy.stats import lognorm\n",
    "lognorm.ppf(0.5, 27915, 0, 26400)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0.495, 8346.32909204472)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import math\n",
    "ans_s=0\n",
    "ans_t=math.inf\n",
    "for s in [0.0005*i for i in range(2000)]:\n",
    "    t = lognorm.ppf(0.01, s, 0, 26400)\n",
    "    delta = math.fabs(t-16700)\n",
    "    if delta < ans_t:\n",
    "        ans_s = s\n",
    "        ans_t = t\n",
    "ans_s, ans_t"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "17000.096021839145"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lognorm.ppf(0.01, 0.1892, 0, 26400)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZQAAAEFCAYAAADE/xFGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3dd3hU17X4/e9SRYUqEE2ARC+ii14ssLGNS5xw3RJyHUhsJ07iG9/8ct8Qx75x8jo3zn3vTZxfEhdcsJ0YEmOMG9WYJkyXKaZXgUWVQCCEurTfP86AJZ0jMSNN1/o8zzyaWefMzDoaxJ5z9t5rizEGpZRSqqkiAp2AUkqp8KANilJKKa/QBkUppZRXaIOilFLKK7RBUUop5RXaoCillPIKbVCUUkp5hc8aFBF5TUQ2ichTnuzjQayjiGTVeBwtIh+JyGci8l1fHJNSSqn6RfniRUVkBhBpjBknIq+LSB9jzOEb7QMMdjOWD7wJJNR4yceBbGPMMyKyVEQWGmOu1Jdj+/btTWpqqncPXCmlwlx2dna+MaaD0zafNChAJvCO6/5KYCJw2I19hrsZWwQ8AHxQ5/XmuO6vBzKANTXfUEQeBR4F6N69O9u3b/f8yJRSqhkTkRP1bfPVJa8E4JTr/kWgo5v7uBUzxhQaYy57+p7GmLnGmAxjTEaHDo4NrFJKqUbyVYNSBMS57ifW8z5O+7gba+x7KqWU8hFf/aebjXVpCmAokOPmPu7GGvueSimlfMRXfSjvA1ki0gWYDjwoIs8aY55qYJ+xgHEz5uRNYKmITAIGAlt8cFxKqQZUVFSQm5tLaWlpoFNRTdSiRQtSUlKI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SvmD9qEopZTyCl+s2KiUqkFE1hpjMl33n8Ga1TwJa/jp7cAl4A0gxXX/fqwSQG8AXYBcYDawCTgPlAOdgHnAYtd+rYGPjDG/88cxKeVEL3kp5X+9jTGTgfewCkY+CuwyxkwEFmHNL3gE2GOMuQk4jFUtIB64D6so4LewCpf+AvinMWY88HURSfL3wSh1jTYoSvnfW66fJ4EYoD+w1RV7A6tG00Bgiyu2GRgAnDPGFAEnsM5gBOgHPOaaPZ2AdUajVEBog6KU/12t8/gAVvFRgCeBh4G9WNVkcf3cW89rHQTmuC6pPYdV6E+pgNAGRanAewUY4TrLGAH8DXgVGCQi67GK/r1Rz3OfA34mIp9h9cec83m2StVDR3kppZTyCj1DUUop5RXaoCillPIKbVCUUkp5hTYoSimlvEIbFKWUUl6hDYpSSimv0AZFKaWUV/z/GGMg/xqZ2uMAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "s = 0.1892\n",
    "xi = lognorm(s=0.1892, loc=0, scale=26400)\n",
    "x = np.linspace(xi.ppf(0.01), xi.ppf(0.99), 100)\n",
    "\n",
    "rr = np.random.lognormal(10.1811, 0.1892, 1000)\n",
    "count, bins, ignored = plt.hist(rr, 50, density=True, label='sample histogram')\n",
    "plt.plot(bins, xi.pdf(bins),'r-', lw=5, alpha=0.6, label='lognorm pdf')\n",
    "plt.legend()\n",
    "plt.xlabel('income')\n",
    "plt.ylabel('probability/frequency')\n",
    "plt.savefig('lognormal.png')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10.181119289134408"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.log(26400)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(105, 2)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "xxx = np.random.binomial(3, 0.04, 1000)\n",
    "np.sum(xxx > 0), np.max(xxx)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAD2CAYAAADcUJy6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3de3Bc5Z3m8e9Pd1nyRca2bAPWxTIGfJUtX2RI0g4BstlMMiFZyGXYqc3UwKZms5ma2qlKNmyFZJnJJptianMhs94wGSYXEphKyCQEECFWQmIbY7VvGDASlmwQviLbctuWrcu7f5wWyKJlHUmndU53P58qldrSOacfS9aj4/e8521zziEiItknL+wAIiKSHip4EZEspYIXEclSKngRkSylghcRyVIFYQcYNGvWLFddXT3u/c+ePUtZWVlwgQIW9XwQ/YxRzwfRzxj1fKCMY9XS0nLCOTc75Sedc5F4W716tZuIzZs3T2j/dIt6PueinzHq+ZyLfsao53NOGccK2OFG6FUN0YiIZCkVvIhIllLBi4hkKRW8iEiWUsGLiGQpFbyISJZSwYuIZCkVvIhIllLBZ5ITJ+Af/xHe/W6oqIDXXgs7kYhEWGSWKpARnD0Lv/gF/PjH8NRT0NcH11wDp07x+Dfu5vmPrA3sqWLEAjuWiIRPZ/BR1NsLjz8On/oUzJnjvd+zB/7mb2DXLnj5ZbrmV1D3/KthJxWRCNMZfFQMDMAf/+idqT/6KLz5JsycCXfe6RX8DTdA3tu/j9vW1rHyyV0UXOyjr0jfRhF5JzVDmJyDvXu9Un/4YTh0CKZMgQ9/GD75SbjlFigqSrlr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N4H/JWZNQMrzex7IedJpQ2oTT5uAKL4dawAlplZPrAO70a/KMqEn5kK4GHg06nO7CPiPcDXhvzcRHI59IyeB29m04BngWdI3i0btX8QZvYZ4O+B3ckPfdc599MQI43IzJqdc7GwcwyXvBD4T3jDCYXAx5xznZffa3KZ2Vrg+3jDNFuBjzjnEuGmetvg99bMqoBfA78BNuD9zPSHm84zJOPX8IblBleX/ZJz7nchRntLqp+RqP7cQIYXPOhuWZGxSi4fciPwVNROiCRYGV/wIiKSWqaPwYuIyAhU8CIiWUoFLyKSpVTwIiJZSgUvIpKl/j9Mf5ebXKBfawAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.random.binomial(7, 0.4, size=10000)  # lam为λ size为k\n",
    "pillar = 15\n",
    "a = plt.hist(x, bins=pillar, density=True, range=[0, pillar], color='g', alpha=0.5)\n",
    "plt.plot(a[1][0:pillar], a[0], 'r')\n",
    "plt.grid()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>f0</th>\n",
       "      <th>f1</th>\n",
       "      <th>f2</th>\n",
       "      <th>f3</th>\n",
       "      <th>f8</th>\n",
       "      <th>f25</th>\n",
       "      <th>f26</th>\n",
       "      <th>f27</th>\n",
       "      <th>f30</th>\n",
       "      <th>f4</th>\n",
       "      <th>...</th>\n",
       "      <th>f22</th>\n",
       "      <th>f23</th>\n",
       "      <th>f24</th>\n",
       "      <th>f28</th>\n",
       "      <th>f29</th>\n",
       "      <th>f31</th>\n",
       "      <th>f5</th>\n",
       "      <th>f7</th>\n",
       "      <th>f9</th>\n",
       "      <th>f6</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20 rows × 32 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    f0  f1  f2  f3  f8  f25  f26  f27  f30  f4  ...  f22  f23  f24  f28  f29  \\\n",
       "0    0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    2   \n",
       "1    0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    5   \n",
       "2    0   0   0   0   0    0    0    0    0   0  ...    0    0    0    1    2   \n",
       "3    0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    2   \n",
       "4    0   0   0   0   0    0    0    0    0   0  ...    0    0    0    1    1   \n",
       "5    0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    2   \n",
       "6    0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    4   \n",
       "7    0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    1   \n",
       "8    0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    2   \n",
       "9    0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    4   \n",
       "10   0   0   0   0   0    0    0    0    0   0  ...    0    0    0    1    0   \n",
       "11   0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    4   \n",
       "12   0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    4   \n",
       "13   0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    2   \n",
       "14   0   0   0   0   0    0    0    0    0   0  ...    0    1    0    0    3   \n",
       "15   0   0   0   0   0    0    0    0    0   0  ...    0    1    0    0    4   \n",
       "16   0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    3   \n",
       "17   0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    5   \n",
       "18   0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    1   \n",
       "19   0   0   0   0   0    0    0    0    0   0  ...    0    0    0    0    1   \n",
       "\n",
       "    f31  f5  f7  f9  f6  \n",
       "0     0   1   1   0   0  \n",
       "1     0   1   1   1   0  \n",
       "2     0   0   1   0   0  \n",
       "3     0   1   0   0   0  \n",
       "4     0   1   1   0   0  \n",
       "5     0   1   0   1   0  \n",
       "6     0   0   0   1   0  \n",
       "7     1   0   1   0   0  \n",
       "8     0   0   0   1   0  \n",
       "9     1   0   0   1   0  \n",
       "10    0   1   0   1   0  \n",
       "11    0   1   1   0   0  \n",
       "12    0   0   0   1   0  \n",
       "13    0   0   1   1   0  \n",
       "14    0   0   1   1   0  \n",
       "15    0   0   1   0   0  \n",
       "16    0   1   0   0   0  \n",
       "17    0   1   0   1   0  \n",
       "18    0   1   0   1   0  \n",
       "19    1   0   0   1   1  \n",
       "\n",
       "[20 rows x 32 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aug = DataSet.data_augment()\n",
    "aug.features.head(20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/lvzhihao/anaconda3/lib/python3.7/site-packages/sklearn/utils/validation.py:72: FutureWarning: Pass kernel=rbf as keyword args. From version 1.0 (renaming of 0.25) passing these as positional arguments will result in an error\n",
      "  \"will result in an error\", FutureWarning)\n"
     ]
    }
   ],
   "source": [
    "from sklearn.decomposition import KernelPCA, PCA\n",
    "from sklearn.preprocessing import MinMaxScaler, StandardScaler\n",
    "from sklearn.pipeline import Pipeline\n",
    "m = Pipeline([('scale',MinMaxScaler()),('pca',KernelPCA(10, 'rbf', n_jobs=-1, n_components=None))])\n",
    "m = m.fit(z.features)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'n_components': 10,\n",
       " 'kernel': 'rbf',\n",
       " 'kernel_params': None,\n",
       " 'gamma': None,\n",
       " 'degree': 3,\n",
       " 'coef0': 1,\n",
       " 'alpha': 1.0,\n",
       " 'fit_inverse_transform': False,\n",
       " 'eigen_solver': 'auto',\n",
       " 'remove_zero_eig': False,\n",
       " 'tol': 0,\n",
       " 'max_iter': None,\n",
       " 'random_state': None,\n",
       " 'n_jobs': -1,\n",
       " 'copy_X': True,\n",
       " 'n_features_in_': 32,\n",
       " '_centerer': KernelCenterer(),\n",
       " 'lambdas_': array([202.02981213, 122.67331742, 103.81108297,  91.59351133,\n",
       "         68.51236841,  62.44361122,  56.23739311,  51.17736871,\n",
       "         41.42039414,  36.01510502]),\n",
       " 'alphas_': array([[ 3.06228477e-03, -2.23827083e-02,  7.84225496e-03, ...,\n",
       "         -3.74377777e-03, -6.28922991e-03,  3.04997819e-02],\n",
       "        [ 6.46948513e-03,  1.31647580e-02,  5.88821120e-03, ...,\n",
       "          5.09715382e-03, -7.44752805e-03, -2.29286718e-03],\n",
       "        [ 1.26226018e-02, -7.41079201e-03,  7.91250398e-03, ...,\n",
       "          2.64775347e-02, -3.37440524e-03,  4.33416182e-03],\n",
       "        ...,\n",
       "        [-1.27775830e-02,  7.24466072e-03, -8.90994764e-03, ...,\n",
       "         -2.51341003e-05, -1.28267328e-02,  2.65936625e-02],\n",
       "        [ 1.55483814e-02,  1.25017850e-03, -9.93865272e-03, ...,\n",
       "          1.59276723e-03, -1.02871086e-02, -2.13513066e-03],\n",
       "        [ 1.56006788e-02,  1.74291773e-03, -8.76294766e-03, ...,\n",
       "         -2.01128462e-02, -1.41018121e-02, -8.56360262e-03]]),\n",
       " 'X_fit_': array([[1.        , 0.        , 0.        , ..., 0.09090909, 1.        ,\n",
       "         1.        ],\n",
       "        [0.        , 0.        , 0.        , ..., 0.04545455, 0.        ,\n",
       "         0.        ],\n",
       "        [0.        , 0.        , 0.        , ..., 0.22727273, 1.        ,\n",
       "         0.        ],\n",
       "        ...,\n",
       "        [1.        , 0.        , 0.        , ..., 0.13636364, 0.        ,\n",
       "         1.        ],\n",
       "        [0.        , 0.        , 0.        , ..., 0.18181818, 0.        ,\n",
       "         0.        ],\n",
       "        [0.        , 0.        , 0.        , ..., 0.18181818, 0.        ,\n",
       "         0.        ]])}"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "m['pca'].__dict__"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "‘linear’, ‘poly’, ‘rbf’, ‘sigmoid’, ‘cosine’, ‘precomputed’"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
